package com.uw.uwconfig.client.config;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ConfigServerMeta {

    private String app;
    private String env;
    private String namespace;
    private String serverAddress;


    public String key() {
        return String.format("%s_%s_%s", getApp(), getEnv(), getNamespace());
    }

    public String listUrl(String contextPath) {
        return String.format("%s/%s?app=%s&env=%s&namespace=%s", getServerAddress(), contextPath, getApp(), getEnv(), getNamespace());
    }

    public String version(String contextPath) {
        return String.format("%s/%s?app=%s&env=%s&namespace=%s", getServerAddress(), contextPath, getApp(), getEnv(), getNamespace());
    }

}
